<?php
class JwpblogMenuHelper
{
	private static $_Instance = array();
	private $_name;
	private $_toolbar; 
	private function __construct($name){
		$this->_name = $name;
		$this->_toolbar =& JToolBar::getInstance($name);
		return $this;
	}
	public static function getInstance($name = 'jwtoolbar'){
		if(!self::$_Instance[$name]){
			self::$_Instance[$name] = new jwpblogMenuHelper($name);
		}
		return self::$_Instance[$name];
	}
	
	public function addEntry($name, $link = '', $active = false)
	{	
		$this->_toolbar->appendButton($name, $link, $active);
	}
	public static function render($name){
		//$menu = self::getInstance($name);
		ob_start();
		require(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'toolbars'.DS.$name.'.php');
		$contents = ob_get_clean();
		return $contents;
	}
	
	function __get($varname){$name = '_'.$varname; return $this->$name; }
}
?>